<?php
//DEFINE orderItem class
			//Each drop down form will store its submitted information in an object of class orderItem
			class orderItem{
				//private customerNum; //primary key in order table? 
				public $sandwichType;
				public $bread;
				public $meat;
				public $cheese;
				public $veggies;
				public $condiments;
				public $drink;
				public $chips;
				public $dessert;
				public $total;
				//constructor to store all submitted values of form
				public function __construct($sandwichType, $bread, $meat, $cheese, $veggies, $condiments, $drink, $chips, $dessert){
					$this->sandwichType = $sandwichType;
					$this->bread=$bread;
					$this->meat=$meat;
					$this->cheese=$cheese;
					$this->veggies=$veggies;
					$this->condiments=$condiments;
					$this->drink=$drink;
					$this->chips=$chips;
					$this->dessert=$dessert;
					$this->total = 0;
				}
				
				public function orderTotal(){
				//use switch statements to add selected item cost to total
					$total = $this->total;
					switch($this->bread){
						case "Wheat":
						$total = $total + 1.00;
						break;
						case "White":
						$total = $total + 1.00;
						break;
						case "French Baguette":
						$total = $total + 1.20;
						break;
						case "Flat":
						$total = $total + 1.10;
						break;
						case "Empty":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					switch($this->meat){
					//add all options for meat and values (no breaks as can have multiple meats)
						case "Ham":
						$total = $total + 1.50;
						break;
						case "Turkey":
						$total = $total + 1.75;
						break;
						case "Shrimp":
						$total = $total + 2.00;
						break;
						case "Chicken":
						$total = $total + 1.75;
						break;
						case "Meatball":
						$total = $total + 2.00;
						break;
						case "pastrami":
						$total = $total + 1.50;
						break;
						case "Empty":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					switch($this->cheese){
					//add all options for cheese and values
						case "Mozzarella":
						$total = $total + 1.00;
						break;
						case "American":
						$total = $total + 1.00;
						break;
						case "Pepper-Jack":
						$total = $total + 1.00;
						break;
						case "Empty":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					switch($this->veggies){
					//add all options for veggies and values (no breaks as can have multiple veggies)
						case "Tomatoes":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Onions":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Avocado":
						$total = $total + 1.00;
						//multiple veggies?
						break;
						case "Black Olives":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Green Peppers":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Lettuce":
						$total = $total + .25;
						//multiple veggies?
						break;
						case "Empty":
						$total = $total + 0.00;
						//default
						break;
						default:
						$total = $total;
						break;
						
						
					}
					switch($this->condiments){
					//add all options for condiments and values (no breaks as can have multiple condiments)
						case "Ranch":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Mayonnaise":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Mustard":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Tomato Sauce":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Hot Sauce":
						$total = $total + .30;
						//more than one condiment?
						break;
						case "Empty":
						$total = $total + 0.00;
						break;
						default:
						$total = $total;
						break;
					}
					
					//Discount for Random Sandwich
					if(strcmp($this->sandwichType,"Random Sandwich") == 0){
						$total = round(($total * 0.85),2);
					}
					//Discount for Sandwich of the day
					if(strcmp($this->sandwichType,"Sandwich of the Day") == 0){
						$total = round(($total * 0.85),2);
					}
					//Discount for Combo Deal
					if($total > 0 && strcmp($this->drink,"Empty") != 0){
						$total = $total - 1.00;
					}
					
					switch($this->drink){
					//add all options for drink and values
					case "Small":
					$total = $total + 1.25;
					break;
					case "Medium":
					$total = $total + 1.50;
					break;
					case "Large":
					$total = $total + 1.60;
					break;
					case "Empty":
					$total = $total + 0.00;
					default:
					$total = $total;
					break;
					}
					switch($this->chips){
					//add all options for chips and values
					case "Potato Chips":
					$total = $total + 1.50;
					break;
					case "Doritos":
					$total = $total + 1.50;
					break;
					case "Corn Chips":
					$total = $total + 1.50;
					break;
					case "BBQ Chips":
					$total = $total + 1.50;
					break;
					case "Sour, Cream, and Onion":
					$total = $total + 1.50;
					break;
					case "Empty":
					$total = $total + 0.00;
					break;
					default:
					$total = $total;
					break;
					}
					switch($this->dessert){
					//add all options for dessert and values
					case "Cookie":
					$total = $total + 1.00;
					break;
					case "Brownie":
					$total = $total + 1.50;
					break;
					case "Vanilla Ice Cream":
					$total = $total + 1.00;
					break;
					case "Empty":
					$total = $total + 0.00;
					break;
					default:
					$total = $total;
					break;
					}
					if(strcmp($this->sandwichType,"Free Prize") == 0){
						$total = 0.00;
					}
					if(strcmp($this->sandwichType, "Free Kid's Meal") == 0){
                        $total = 0.00;
                    }
					$this->total = $total;
					return (float)$total;
				}
				//Method that pushes information to database
			}
            ?>